// our hero, the illusionist

#pragma once

#include "actor.h"
#include "../gameSettings.h"
#include "../soundManager.h"


void deactivateIllCloak(Actor *actor);


class Ill : public Actor {

public:
	bool isCloaked;
	int lives;

	Ill(int in_x, int in_y, Facing in_o)
		: Actor(in_x, in_y, in_o), isCloaked(false), lives(ILL_LIVES) {}

	// get the tile representing the current actor
	TILE_TYPE getTile() {
		if (!isCloaked) {
			return (TILE_TYPE)(ILL_N + o);
		} else {
			return (TILE_TYPE)(CLOAK_N + o);
		}
	}

	void activateCloak() {
		isCloaked = true;

		addCallback(new TimedCallback(deactivateIllCloak, CLOAK_DURATION, false));
	}

	void deactivateCloak() {
		isCloaked = false;
	}

	bool isKillable() {
		return !isCloaked;
	}

	int getLives()
	{
		return lives;
	}

	void setLives(int remLives)
	{
		lives = remLives;
	}

	void loseLife()
	{
		playSfx(SFX_PLAYER_DEATH);
		--lives;
	}
};

// end of ill.h
